import time
import asyncio


# def method1():
#     while True:
#         print("m1")
#         time.sleep(1)
#
#
# method1()
#
#
# def method3():
#     while True:
#         print("m3")
#         time.sleep(1)
#
#
# method3()


# 协程  coroutine
# async def method1():
#     await asyncio.sleep(1)
#     print("m1")
#
#
# # 启动携程
# asyncio.run(method1())


async def method1():
    while True:
        await asyncio.sleep(1)
        print("m1")


async def method2():
    while True:
        await asyncio.sleep(1)
        print("m2")


async def main():
    task1 = asyncio.create_task(method1())
    task2 = asyncio.create_task(method2())

    await task1
    await task2

asyncio.run(main())
#
#
# def method3():
#     while True:
#         time.sleep(1)
#         print("m3")
#
# method3()



